﻿
using CommunityToolkit.Mvvm.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Company.Database.Entities
{
    public abstract class EntityBase : ObservableObject
    {
        private int id;
        /// <summary>
        /// 主键ID
        /// </summary>
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自动递增
        public int Id
        {
            get { return id; }
            set { SetProperty(ref id, value); }
        }

        private DateTime insertDate = DateTime.Now;
        /// <summary>
        /// 插入时间
        /// </summary>
        public DateTime InsertDate
        {
            get { return insertDate; }
            set { SetProperty(ref insertDate, value); }
        }
    }
}
